﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucQuanLyTinNhan.ascx.cs"
    EnableViewState="false" Inherits="STT.Admin.UserControls.ucQuanLyTinNhan" %>

<%--<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>--%>

<%--<div id="content-header">
    <div id="breadcrumb">
        <a href="../Admin/Default.aspx?idpage=1" class="tip-bottom" data-original-title="Về bảng điều khiển">
            <i class="icon-home"></i>Trang chính
        </a>
        <a href="../Admin/Default.aspx?idpage=qltn" class="current">Quản lý tin nhắn</a>
    </div>
</div>--%>

<div class="widget-box widget-chat">
    <div class="widget-title">
        <span class="icon">
            <i class="icon-comment"></i>
        </span>
        <h5>Danh sách tin nhắn</h5>
    </div>
    <div class="widget-content nopadding">
        <div class="chat-users panel-right2">
            <div class="panel-title" style="background-color: white !important">
                <asp:TextBox ID="txtTimKiem" runat="server" placeholder="Nhập từ tìm kiếm..."
                    CssClass="txtTimKiem"></asp:TextBox>
                <button class="tip-left" data-original-title="Tìm kiếm" style="background-color: white;
                    border: none;">
                    <asp:ImageButton ID="btSearch" runat="server" ImageUrl="~/img/icon-search.png" Style="margin-top: -4px"
                        OnClick="btSearch_Click" />
                </button>
            </div>
            <div class="panel-content nopadding">
                <ul class="contact-list">
                    <% if (tbUser != null) for (int i = 0; i < tbUser.Rows.Count; i++)
                           { %>
                    <li class="online"><a href="../Admin/Default.aspx?idpage=qltn&idmessage=<% Response.Write(tbUser.Rows[i]["TenDN"].ToString().Trim()); %>">
                        <img alt="" src="../../uploads/avatar/<%Response.Write(tbUser.Rows[i]["Anh"].ToString() == "" ? "avatar-default.jpg" : tbUser.Rows[i]["Anh"].ToString().TrimEnd()); %>" />
                        <span><%Response.Write(tbUser.Rows[i]["TenNguoiDung"].ToString().Trim()); %></span></a>
                    </li>
                    <% } %>
                </ul>
            </div>
        </div>
        <div class="chat-content">
            <div class="chat-messages" id="chat-messages">
                <div id="chat-messages-inner">
                    <asp:ListView ID="lvTinNhan" runat="server" Style="width: 100%"
                        DataKeyNames="IdGui,IdNhan,ThoiGianGui"
                        OnItemCommand="lvTinNhan_ItemCommand"
                        OnItemDeleting="lvTinNhan_ItemDeleting"
                        OnItemDataBound="lvTinNhan_ItemDataBound">
                        <ItemTemplate>
                            <div class="date_spend"></div>
                            <p style="display: block;">
                                <span class="msg-block">
                                    <img src="../../Uploads/Avatar/<%# Eval("Anh").ToString().Trim()==""? "avatar-default.jpg" : Eval("Anh").ToString().Trim() %>"
                                        alt="img"><strong><%# Eval("TenNguoiGui").ToString().Trim()%></strong><asp:LinkButton
                                            ID="LinkButton1" runat="server" CommandName="Delete">                               
                                        <img src="../../img/close.png" class="<%# Display(Eval("IdGui").ToString().TrimEnd()) %>" alt="Alternate Text" style="float:right; width:16px; height:16px; margin-top:3px; margin-left:5px;" title="Delete" class="delete" />
                                        </asp:LinkButton>
                                    <span class="time"><%# DateTime.Parse(Eval("ThoiGianGui").ToString().Trim()).ToLongTimeString()%></span>
                                    <span class="msg"><%# Eval("NoiDung").ToString().Trim()%></span></span>
                            </p>
                        </ItemTemplate>
                    </asp:ListView>
                </div>
            </div>
        </div>
    </div>
</div>

<%--</ContentTemplate>
</asp:UpdatePanel>--%>

<script>
    var height = $('.chat-content')[0].scrollHeight;
    $('.chat-content').scrollTop(height);
</script>
